/**
 * 
 * @authors Your Name (you@example.org)
 * @date    2018-07-16 19:19:38
 * @version $Id$
 */
// alert("hello word")
     // 登录框
var login=document.getElementById("login");
var fath=document.getElementById("father");
var son1=document.querySelector(".son1");
var son2=document.querySelector(".son2");
var reset=document.getElementById("reset");

     login.onclick=function(){
   
        fath.style.display="block"
    
     }
    son1.onclick=function(){
        fath.style.display="none"
    }
    reset.onclick=function(){
          fath.style.display="none"
    }

var submit=document.getElementById("submit");
    submit.onclick=function(){
      var  uname=document.getElementById("uname").value;
      var  umm=document.getElementById("umm").value;
       if(uname.length==0||umm.length==0){
        alert("输入内容不能为空");
        fath.style.display="block"
       }
       if(uname.length!=0&&umm.length!=0){
       fath.style.display="none";
        login.innerHTML=uname;
        }

    }
   


               // 弹性计算
 var list= document.querySelectorAll("#coldmn .container ul li");
var img= document.querySelectorAll("#coldmn .container ul li img");
var divs=document.querySelectorAll("#coldmn1 div");
   
   function sub(i){
        list[i].onclick=function(){
          for(var j=0;j<list.length;j++){
             list[j].children[0].className="";
             list[j].children[1].className="hidden";
              divs[j].className="container none";
          }
            list[i].children[0].className="hidden";
            list[i].children[1].className="";
            divs[i].className=divs[i].className.replace("none","block");
           
        }  
    
     }
            
  for (var i=0;i<list.length;i++){
      sub(i);
   }
   console.log(list.length);
   console.log(divs.length)




           // loading图
 window.onload=function(){
    var load=document.getElementById("loading");
      load.style.display="none";
 }


      // 动态图
//    var fat=document.getElementById("father1")
//     var son=document.getElementsByTagName("p")
//     function move(){
//         var timer,h=0;
//         son[i].onmouseover=function(){

//             clearInterval(timer);
//             var a=this;
//               function fun(){
//             if(h>-4425){
//                 h-=75             
//             a.style.backgroundPosition=0+"px "+h+"px";
//             }
//         }  timer=setInterval(fun,20,a)
//         }
//         son[i].onmouseout=function(){
//             clearInterval(timer);
//              var a=this;
//             function fan(){
//                 if(h<0){
//                     h+=75
//                     a.style.backgroundPosition=0+"px "+h+"px"
//                 }
//             }
//             timer=setInterval(fan,20,a)
//         }
     
//     }
//     for(var i=0;i<son.length;i++){
//       move()
// }
// 
//    同上
   var fat=document.getElementById("father1")
    var son=document.getElementsByTagName("p")
    function move(n){
        var timer,h=0;
        son[n].onmouseover=function(){

            clearInterval(timer);

              function fun(){
            if(h>-4425){
                h-=75             
            son[n].style.backgroundPosition=0+"px "+h+"px";
            }
        }  timer=setInterval(fun,20)
        }
        son[n].onmouseout=function(){
            clearInterval(timer);
 
            function fan(){
                if(h<0){
                    h+=75
                    son[n].style.backgroundPosition=0+"px "+h+"px"
                }
            }
            timer=setInterval(fan,20)
        }
     
    }
    for(var i=0;i<son.length;i++){
      move(i)
}


    // 点状扩散
 var point=document.querySelectorAll(".point1")
    var i=0;a=point.length;
     console.log(a)

        function fun(){
           for(var i=0;i<a;i++){
            if(parseInt(point[i].style.width)!=100){
               
              point[i].style.height=point[i].style.width=parseInt(point[i].style.width)+2+"px"  
     
           point[i].style.left=point[i].style.top=parseInt(point[i].style.top)-1+"px"

        
            }
        else{
             point[i].style.height=point[i].style.width=0+"px"

          point[i].style.left=point[i].style.top=49+"px"


        } 

}
    } 
     var id=setInterval(fun,100); 





                // banner 动态图
    var  menu=document.querySelectorAll(".video_menu li");
    var lister=document.querySelectorAll(".advance li");
    var jdt=document.querySelectorAll(".advance li .advance_son")
    var jd=document.querySelectorAll(".advance li")
     var m=0 ,timer1,timer2;
     timer2=animation(jdt[0],"width",60,4500)
     function fmn(){
        clearInterval(timer2);
        menu[m].style.zIndex=1;
        menu[m].style.top=100+"px"
        menu[m].style.opacity=0;
        animation(menu[m],"opacity",1,500)
        animation(menu[m],"top",0,500)

         for(var a=0;a<jdt.length;a++){
            jdt[a].style.width=0+"px"
            jd[a].className=""
         }
        timer2=animation(jdt[m],"width",60,4500)           
     }

     function move1(){ 
          timer1=setInterval(
             function(){
                for(var j=0;j<menu.length;j++){
                    menu[j].style.opacity=0;
                }
             menu[m].style.zIndex=0;
             
              m++;
               if(m==menu.length){
                m=0;
              }    
               fmn()     
             },5000)
     }

     move1()
   
    for (var b = 0; b < jd.length; b++) {
        jd[b].onclick=function(){
             for(var a=0;a<jdt.length;a++){
            jdt[a].style.width=0+"px"
            jd[a].className=""
         }
            clearInterval(timer2)
                jd[m].className=""
            this.className="white"
            var index=this.getAttribute("index");
            menu[m].style.zIndex=0;
           m =index
            console.log(m)
         menu[m].style.zIndex=1;
        menu[m].style.top=100+"px"
        menu[m].style.opacity=0;
          animation(menu[m],"opacity",1,500);
        animation(menu[m],"top",0,500);

        }
    }
   